<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>et</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
    <meta name="author" content="Muhammad Usman">

<style>
.error {
    color: red;
}
</style>

<%@include file="/commons/commonHead.jsp"%>
<script src="<%=basePath%>charisma/js/charisma.js"></script>

<script type="text/javascript">

window.onresize=function(){ 
            location=location; 
        }; 
        
        
$(document).ready(function() { 	
	ajaxDiv(false, '', '<%=basePath%>mgt/school/toSchoolSimple.do','' , showSchool2);
		$('[data-rel="chosen"],[rel="chosen"]').chosen();
		$("#schoolId_chosen a").css({"height":"54px","line-height":"54px"});
	if($.cookie("sysUserName")!=null){
		$("#userName").val($.cookie("sysUserName"));
	}	
});  


function showSchool2(data,divId){
	$("#schoolId").html("");
	var schoolList = data["schoolList"];
	for ( var i = 0; i < schoolList.length; i++) {
		var school = schoolList[i];
		if(school!=null){
			$("#schoolId").append('<option value="'+school.id+'">'+school.schoolName+'</option>');
		}
	}
}
	   
function login(){
    $("div .clearfix").html("");
	var userName=$("#userName").val().Trim();
	var password=$("#password").val().Trim();
	if(userName==""){
		$("#userName").parent().next().append('<span class="error">用户名不能为空！</span>');
		return;
	}
	if(password==""){
		$("#password").parent().next().append('<span class="error">密码不能为空！</span>');
		return;
	}
	ajaxForm(false, '', '<%=basePath%>mgt/sys/login.do', 'loginForm', login2);
}	

function login2(data,divId){
	if(data["flag"]==0){
		window.location.href='<%=basePath%>mgt/sys/index.do';
	}else{
		alert(data["message"]);
	}
}

String.prototype.Trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, "");
};   
</script>
</head>

<body>
<div class="ch-container">
    <div class="row">
        
    <div class="row">
        <div class="col-md-12 center login-header2">
            <img src="<%=basePath%>charisma/img/logo-et.png">
        </div>
        <!--/span-->
    </div><!--/row-->

    <div class="row">
        <div class="well col-md-5 center login-box">
            <div class="alert alert-info">
               欢迎来到easy talk订课系统
            </div>
            <form id="loginForm" class="form-horizontal" action="<%=basePath%>mgt/login/login.do" method="post">
                <fieldset>
                    <div class="input-group input-group-lg">
                        <span class="input-group-addon"><i class="glyphicon glyphicon-user blue"></i></span>
                        <input type="text" id="userName" name="userName" class="form-control" placeholder="用户名">
                    </div>
                    <div class="clearfix"></div><br>

                    <div class="input-group input-group-lg">
                        <span class="input-group-addon"><i class="glyphicon glyphicon-lock blue"></i></span>
                        <input id="password" type="password" id="password" name="password" class="form-control" placeholder="密码">
                    </div>
                    <div class="clearfix"></div>
                    <br>
                    <div class="input-group input-group-lg">
                        <span class="input-group-addon"><i class="glyphicon glyphicon-lock blue"></i></span>
                         <select id="schoolId" name="schoolId" data-rel="chosen"  class="form-control" >
	                        </select>
                    </div>
                    <div class="clearfix"></div>

                    <div class="input-prepend">
                        <label class="remember" for="remember"><input type="checkbox" id="remember" name="remember" value="1"> 记住用户名</label>
                    </div>
                    <div class="clearfix"></div>

                    <p class="center col-md-5">
                        <button type="button" class="btn btn-primary" onclick="javascript:login();">登录</button>
                    </p>
                </fieldset>
            </form>
        </div>
        <!--/span-->
    </div><!--/row-->
</div><!--/fluid-row-->

</div><!--/.fluid-container-->



</body>
</html>
